package com.itmuch.cloud.microservicesimpleconsumermovie.comtroller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.itmuch.cloud.microservicesimpleconsumermovie.user.User;

@RestController
public class MovieController {

	@Autowired
	private RestTemplate restTemplate;
		
	@Value(value = "${user.pathname}")
	private String pathname;
	
	
	@GetMapping("/movie/{id}")
	public User findById(@PathVariable("id") Long id) {
		System.out.println("pathname:"+pathname);
		return restTemplate.getForObject("http://localhost:7900/simple/"+id, User.class);
	}
	
}
